//
//  HomeCommodityTableViewCell.m
//  Ev_Master
//
//  Created by Evan on 2019/7/3.
//  Copyright © 2019 Evan. All rights reserved.
//

#import "HomeCommodityTableViewCell.h"

@implementation HomeCommodityTableViewCell


+ (instancetype)cellWithTableView:(UITableView *)tableView  IndexPath:(NSIndexPath *)indexPath{
    NSString *Service = [NSString stringWithFormat:@"HomeCommodityTableViewCell_%ld_%ld",indexPath.section,indexPath.row];
    HomeCommodityTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Service];
    if (cell == nil) {
        [ tableView registerNib:[UINib nibWithNibName:@"HomeCommodityTableViewCell" bundle:nil] forCellReuseIdentifier:Service];
        cell = [tableView dequeueReusableCellWithIdentifier:Service];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.viewLeft.layer.cornerRadius = 10;
    self.viewLeft.layer.shadowColor = [UIColor grayColor].CGColor;
    //        阴影的透明度
    self.viewLeft.layer.shadowOpacity = 0.4f;
    self.viewLeft.layer.shadowOffset = CGSizeMake(0, 0);
    //        阴影的圆角
    self.viewLeft.layer.shadowRadius = 4.0f;
    self.viewLeft.clipsToBounds = YES;
    
    
    self.viewRight.layer.cornerRadius = 10;
    self.viewRight.layer.shadowColor = [UIColor grayColor].CGColor;
    //        阴影的透明度
    self.viewRight.layer.shadowOpacity = 0.4f;
    self.viewRight.layer.shadowOffset = CGSizeMake(0, 0);
    //        阴影的圆角
    self.viewRight.layer.shadowRadius = 4.0f;
    self.viewRight.clipsToBounds = YES;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(viewClick:)];
    [self.viewLeft addGestureRecognizer:tap];
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(viewClick:)];
    [self.viewRight addGestureRecognizer:tap2];
    
    self.viewRightTitle.text = @"";
    self.viewRightPrice.text = @"";
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


-(void)viewClick:(UITapGestureRecognizer *)tap{
    UIView *view =  tap.view;
//     view.tag;
    if (view.tag > 0 ) {
        self.blockTapViewId(view.tag);
    }
    
}

@end
